Photography is a two dimensional medium which we use to represent a three dimensional world. The basic visual cues that allow us to infer the third dimension in a photograph include:
Size -- whenever we have familiar objects in the frame, we use their relative size as a clue to their relative distance from us.
Focus -- Something which is sharply focused in an image will be perceived as being either closer or farther away than something which is clearly out of focus.
The two images above use size as one visual cue to the which elements are closer to the viewer, and which are further away. The flower also uses differences in sharpness to aid in creating an illusion of greater three-dimensional depth: the bloom that is both sharper and larger appears to us as being closer. The image of the Amsterdam canal boat uses relative size, as well as converging liners to create the illusion of depth.
Visual cues such as receding lines -- the familiar illusion created by the lines a highway that appear to converge into the distance.
There is also another visual cue that we can use to create or enhance the illusion of “three-dimensionality”: the relationship between light and dark tones in an image. All things being equal, areas in a picture that are lighter in tone will appear to advance toward the viewer, and those that are darker will appear to recede.