Cis Orientation of dienophiles orientation of groups maintained in Diels Alder
To answer you question, imagine (or: build a molecular model) that the newly formed six-membered ring may be simplified as a flat disk.  Then


either you start with a (trans)-configurated diene, as in the first example drawn by you.  Since the Diels-Alder simultaneously forms the new $\sigma$-bonds on the expense of $\pi$-bonds and moves the location of the remaining double bond, the substitutents R are either both below, or both above this reference plane.  Relatively to each other, these substitutents R in the product conserved their (cis)-relationship from the dienophile.
or, if your dienophile is (trans)-configurated, yielding a product were one of the substitutents is above, and the other is below this reference plane; corresponding to the second example drawn by you where are R conserved their (trans)-relationship to each other.


On paper, the observed conservation of sterochemical information is both the synchronicity of the events (pushing the pairs of electrons, absence of [charged] intermediates as e.g. in nucleophilic substitutions), as well as the principle of conserving the symmetry of molecular orbitals envolved here.