There's what is legal, and then what is responsible. Miami_JBT already covered the legal part. The only thing I'll add is that we're assuming US territorial waters or international waters here. If you enter another Countries' waters (including their economic exclusion zones) it gets more interesting.
As far as what's responsible, ricochets do happen off water - and can go a LONG way. I only shoot rifles or handguns where I can't see anyone through binoculars to the horizon (roughly 23 to 28 miles), and even then I generally try to shoot from the highest point on the boat (the third story) downward. This dramatically reduces chances of a ricochet. Shooting from a few feet above the water would be a lot more risky IMHO. Shooting on inland waters or near shore towards land seems negligent to me unless you're using a shotgun.