Scalar fields as sources for wormholes and regular black holes