Because they trained their dogs much more than the average dog owner.
The usual dog owner:
- Trains the basic copmmands (sit / no / come here) in a calm environment without distraction
- Stops most or all of the training once the dog is juvenile or adult
- Has little to no control over the dog when it's distracted or too far away
The professional dog owner (including shepherds, police officers, rangers and hunters):
- Trains the basic commands and things like "stay", "retrieve" or similar commands, which control the dog from a further distance
- Doesnt't stop training. Ever. Dogs deployed in certain jobs have to be trained every single day.
- Uses positive reinforcement instead of punishment. That way the dog feels happy during training and real service.
By the way, the same could be applied to other service animals than dogs. The horses of mounted policemen have to be trained not to panic in chaotic situations, circus animals have to be taught their tricks, I've even seen the Mythbusters train goldfish to swim through a labyrinth... All done by constant repitition and positive reinforcement.