I biked across the US this year and had many, many encounters with dogs. Took me a while, but I eventually learned how to handle them. It may sound ridiculous, but you shouldn't speed away (unless you can easily get away) since that will just encourage them to chase you. You should confront the dog, look them in the eye, stare them down, yell at them, kick at them, spray water at them, but remain engaged all the while moving along. If you have a good head of steam going, go directly at them.
If the dog is a real problem, call the police. You'll be doing the community a favor since a little kid biking along would never be able to handle the dog as well as a grown cyclist.