Constraints on the anomalous magnetic moment of the W boson from the magnetic moment of the muon