Inverse approach to Einstein's equations for fluids with vanishing anisotropic stress tensor