Reconstruction of the deceleration parameter and the equation of state of dark energy