Which one is independent of medium varies. It can be E or D for electric, & it can be B or H for magnetic. Take a parallel plate capacitor with 2 dielectrics in parallel, air & plastic. The plastic has a relative permittivity of 10, eps_r = 10. The boundary conditions are that for the 2 media, their tangential components of E must be equal. Hence, Eair = Eplastic. But the D values depend on the medium. In this case, Dplastic = eps_r*Dair = 10*Dair. Of course, D = eps*E = eps_r*eps0*E. In this case E is independent of the medium, where D scales according to medium's permittivity.
But if the dielectrics are stacked in series, we have a different relation. The normal components of D must either be equal, or can at most differ by only a constant. So we have: Dplastic - Dair = rho_s, where rho_s is equal to the surface charge per unit area. If there is no surface charge, then Dair = Dplastic. But the E components scale according to the dielectric constants of the 2 media. Eair = 10*Eplastic. In this case D is independent of the medium, where E scales according to the inverse of the medium's permittivity.
In the magnetic domain, we have a similar relation. Take a magnetic core, excited by a current in its winding. The core has an air gap. Let's say the core is ferrite w/ a relative permeability of 100, & the gap is air (mu_r = 1). The boundary condition here is that the B field normal components are the same for both media. So, Bair = Bfe. But the H values scale in inverse proportion to the permeability, i.e. Hair = 100*Hfe.
Same problem, but the gap consists of 2 parallel spacers, one paper w/ mu_r = 1, the other cobalt alloy w/ mu_r = 10. Here the boundary condition is that the H field tangential components are equal for the 2 media. So we get Hpaper = Hco. But the B fields scale in direct relation to the relative permeabilities of the media, i.e. Bco = 10*Bpaper.
That's the long & short of it. Another example for magnetic fields is an inductor driven by a current source or voltage source plus series resistor. If 2 identical windings are placed in series w/ current source, the 1st being air cored, the 2nd being a ferrite w/ mu_r = 100, the H values are the same for both. The B values scale so that Bfe = 100*Bair.
If we place the windings in parallel, & excite them from an ac voltage source, the B values are the same. But the H values scale inversely w/ mu_r. Hence Hair = 10*Hfe.
Which one depends on the medium & which one is medium-independent can vary. Between E/D, & H/B, it can go either way. Also, B is magnetic flux density, whereas H is magnetic field intensity. Elecric flux density, aka electric displacement, is called D, whereas electric field intensity is E. I hope I've helped.
Claude