The law is not voluntary. All cruise ships (as defined within the law) which "embark or disembark passengers in the United States" have to comply. There are civil and criminal penalties for non-compliance by both the cruise line or individual employees.
Maritime law is very complex. Prior to this law, the FBI had juridiction for crimes committed on the high seas if the ship had left or was returning to a U.S. port. The cruise ships will comply because it is cheaper than being denied entry into U.S. waters. The flag of convenience for the ship doesn't matter if the cruise line maintains corporate offices in the U.S. And they all do.
Now, if an assault occurs while a ship is in Cozumel, of course Mexican police have jurisdiction. However the cruise ship is still required to document the assault and report it to the FBI and U.S. Coast Guard.
It might be helpful to read a more detailed overview of the law, such as this one