To go from a signal to a power spectrum, the Fourier Transform algorithm (or its discrete version) provides a classic method. The Inverse Fourier Transform will do the reverse.
One thing to watch for - when you generate a power spectrum from a signal, each component of the spectrum should have an amplitude AND A PHASE. You may have missing information if you only have the amplitude of the frequency components, and don't know their phase.
To generate model timeseries, you might have to iterate over randomly chosen phase values for each component of the spectrum, to generate a population of potential solutions to the signal.
If you have two separate amplitude power spectra, observed at different times, then it is possible to iteratively recover the missing phase information by transforming back and forth between signal and frequency space, and at each step when you reach frequency space, updating the amplitude estimates based on the observations. The resulting phase estimates will eventually converge on the correct solution, given sufficiently little noise in the observations. The Gerchberg-Saxton and Fienup algorithms are of interest here.
This related question has more information about why you need the phase: https://stackoverflow.com/questions/49625895/how-to-retrieve-original-signal-from-power-spectrum
This paper details some of the ways to recover missing phase information in inverse spectral decomposition: https://arxiv.org/pdf/1705.09590.pdf