Reconstructions of the dark-energy equation of state and the inflationary potential