You really can't, it's just the way dogs are. This is simply a dominance thing. It is the humans that are offended by it, the dogs will figure it out themselves.
When two dogs off the same sex hump each other it shows that is a sign of dominance. So if a dog ever humps you thats a reminder to not get that dog mad. ;)