Most of the shark "attacks" in beach areas are on swimmers, not divers, most are in shallow water where the visability is low from sand and bottom debris being kicked up and the shark just detects movement and goes after it thinking it's a food source. They are not making a consious attack on humans.
You rarely if ever hear of a diver being "attacked" by a shark and usually if they are, it's a spear fisherman or abalone diver, someone that has a food source on them.
One of my main motovations for learning to dive was to dive with sharks, I love them!!! little looney I know, but that's the truth. I also learned to dive on Midway Island when I was in the Navy in the early '80's. We had one of the highest shark populations on earth. We rarely made a dive without seeing at least one. They almost always keep a good distance from divers, no matter what the species or size was. They did't want anymore to do with us than we wanted to do with them, except me of course, who usually swims towards a shark when I see one, and they almost always swim the other direction.
I have never felt threatened in any way by sharks while diving, I've always been a little nervous surfing however, being on top of the water is a totally different thing!!!
The sharks on the 'shark feeding' dives in the Bahamas and other places, are very used to being around large groups of divers and as long as you follow the dive ops rules, you should be fine. Don't try any of the antics the dive op divers do like petting them like dogs on the head, holding a shark like a baby or grabbing one by the tail, these guys have years of experience with these animals and can real aggressive behavior.
If you see one, feel blessed, respect it's space and sit back and enjoy one of the most graceful animals you'll every see.
Yes, I do occationally get rather close!!!!