Reconstructing isotropic and anisotropic f(Q) cosmologies