The dielectric anisotropy of liquid crystals causes director reorientation in an applied electric field and is thus at the heart of electro-optic applications of these materials. The components of the dielectric tensor are frequency dependent. Until recently, this frequency dependence was not accounted for in a description of director dynamics in an electric field. We theoretically derive the reorienting dielectric torque acting on the director, taking into account the entire frequency spectrum of the dielectric tensor. The model allows one to include the effects of multiple relaxations in both parallel and perpendicular components of the dielectric tensor, thus generalizing a recent model [Y. Yin et al., Phys. Rev. Lett. 95, 087801 (2005)] limited by the single-relaxation approach. The model predicts the "dielectric memory effect" (DME)-i.e., dependence of the dielectric torque on both the "present" and "past" values of the electric field and the director. The model describes the experimentally observed director reorientation in the case when the rise time of the applied voltage is smaller than the dielectric relaxation time. In typical materials such as pentylcyanobiphenyl (5CB), in which the dielectric anisotropy is positive at low frequencies, the DME slows down the director reorientation in a sharply rising electric field, as the sharp front is perceived as a high-frequency excitation for which the dielectric anisotropy is small or even of a negative sign. In materials that are dielectrically negative, the DME speeds up the response when a sharp pulse is applied.