Their survival is based on finding food and staying healthy. So, as you can imagine, intentionally picking a fight with an animal of equal size, strength and health just wouldn't be smart. Do some sharks hunt dolphins. Yes, some species of dolphin can be hunted by sharks. For example, white sharks hunt harbor porpoises.
Some whales can hunt sharks, too.
A killer whale is the prime example. Sure. bottlenose dolphins, for example, have been found with scars of shark bites or wounds. The bites are usually found on the back and bottom of the animal. An interesting note, harbor porpoises, unlike bottlenose dolphins rarely are found with these scars. Which probably means they end up as lunch - as was intended by an attack.