All those pretty birds you see are like one mistake and bit of bad luck from being ripped to shreds—at all times. Yikes.
The advice I grew up with (in swedish bear country) is to do these things, in order:
1. Make noise while in the woods, bears will generally avoid you if they know you are there. You don’t want to startle a bear.
2. If charged, stay calm, make yourself big and talk to the bear, move slowly.
3. If attacked, play dead.
With luck, the bear will lose interest once it doesn’t perceive you as a threat. If it’s hungry, well, bad luck. There have been cases of people scaring bears off by punching them in the nose, so as a final resort I guess that’s something to try.
And horses¹. And deer².
They will respect animals in their "family" herd, but don't have this restriction against cattle from other herds or species that are not defending, specially when not feed accurately by the owners (If they guard sheep they can still see young cows as fair game).
The main difference between wolves and shepherd dogs is that dogs aren't neither afraid to cows or men.