The invention relates to a device (1) and a method for converting thermal energy of low temperature to thermal energy of high temperature by means of mechanical energy and vice versa, said device comprising a rotor (2) that is rotatably supported about a rotational axis (3), a flow channel for a working medium that runs through a closed cycle being provided in the rotor, wherein the flow channel has a compression channel (8), a relaxation channel (10), and two connection channels (9, 11) extending substantially parallel to the rotational axis (3), and furthermore heat exchangers (13, 14) for exchanging heat between the working medium and a heat-exchange medium are provided, wherein the compression channel (8) and the relaxation channel (10) each have a heat-exchange segment (8', 10'), each of which has a heat exchanger (13, 14) that rotates together with the compression channel (8); or the relaxation channel (10) associated therewith, said heat exchanger being formed by at least one heat-exchange channel (15, 18) that conducts the heat-exchange medium.