Constraints on anomalous Higgs boson couplings to vector bosons and fermions in its production and decay using the four-lepton final state