Lattice relaxation in solid solutions: long-range vs. short-range structure around Cr3+ and Co2+ in oxides and silicates