It depends on the dog.
Dogs have far superior senses to humans, which is why dogs became man's best friend, it was mutually beneficial for us to coexist. Early man gave docile wolves their scraps from their kills, and in return, the domesticated wolves provided man with an early warning system against predators and other enemies. Protection from large predators such as bears and wild wolves is exactly what dogs were originally kept and bred for.
I'm from wild bear country, where no one goes out into the woods without some sort of bear protection. Usually that bear protection is a shotgun or a large rifle, next to that, they take dogs. Bear spray is one of the last things they consider bringing with them (except for in certain national and provincial parks where dogs are hardly welcome). I feel infinitely safer hiking with my dog than I do with a can of bear spray.
I've encountered several bears while with my dog. The first time was when I was only 10 years old backpacking with my Dad, we had our pure-bred German Shepherd with us off leash in Height of the Rockies Provincial Park. She was leading the trail when all of a sudden we rounded a corner and found her with her hair raised looking up the mountain into the trees, she let out one insecure bark after which it sounded like the forrest started to come down. Not far up the hill was a huge Grizzly, who was startled by the bark and started crashing through the bush to get a safe distance before turning to check us out. We quickly moved on and the bear didn't pursue us.
Dogs are also great for sniffing out bears that you don't yet see, and scaring them off before you encounter them. My current dog is a German Shepherd/Black Lab cross (who more often than not gets mistaken for a black bear by other hikers), and he gets very aggressive and intimidating when he catches a whiff of a bear on the trail ahead. He doesn't chase them, but his barking seems to be enough to warn the bears that we're approaching and scare them off.
I think it makes a big difference what type of dog you have and how well they behave. My dogs all grew up hiking in the woods, they've met all sorts of wild creatures and they've all been obedient enough to come when called and not give chase when commanded to stay. The dogs that would give you problems would be the little ankle biters that yip at everything and don't listen to anyone, I can see one of those antagonizing a bear, because they aren't intimidating, and are more likely to be pursued as food. The reason parks say keep your dogs on leash, or don't take them into the backcountry at all is because far too many people that visit parks have stupid disobedient family dogs that spend most of their time tied up in the back yard or at the end of a leash, they don't know how to behave in the woods.
Dogs are excellent protection from bears, especially in numbers, but they must be the right breed, the right temperament, obedient, and large enough to intimidate a bear.
Height of the Rockies Provincial Park is an example of a park that doesn't say, "Keep dogs on leash in the backcountry." instead they say, "Dogs in the backcountry must be under control at all times." If you have an obedient dog that comes when he's called, and doesn't chase every critter that he encounters on the trail then odds are good he'll do more to deter a bear than provoke one as long as he's got a big enough bite to back up his bark.