It does depend on the individual dog but the general rule of thumb is that the dog should be under constant supervision or safely confined in some way until the dog is fully mature (for it's breed). This is generally sometime between 1-2 years of age (and sometimes later), after s/he has gone through the drive-you-crazy adolescent period when dogs, like all adolescents, seem to regress and forget every bit of "manners" you've taught them up to that point.
I learned this lesson the hard way with my first collie. When he was almost a year old I thought he was old enough to have house freedom. He was fully housebroken after all. Boy was I wrong! I came home from work to find the coffee table was no longer a table. It had become kindling. The dog was lucky to not get any splinters in his nose or mouth and was fine. Also, luckily for me, the coffee table was a cheap one and easily replaced.
