Donald Trump's Secretary of the Navy is leaving his post "effectively immediately", the Pentagon has announced.