I'm a native U.S. English speaker). I think either is fine, with no obvious difference in meaning.
When they first began putting warnings on cigarette packages in the United States, the wording was "Caution: Cigarette Smoking May be Hazardous to Your Health." It made big headlines at the time, and the wording of the message became a sort of familiar saying.
Later versions of the warning also used "to," "dangerous to your health," "serious risks to your health."
The warning has a kind of status as a catchphrase or saying, and people make joking references to it, like "Warning, high fees in retirement plans are hazardous to your wealth."
It's possible that these warnings have made the phrasing "dangerous to your health" a familiar pattern that "rolls off the tongue," particularly in the context of smoking.