We can convert one flip-flop to another flip-flop by adding some additional gates to the existing flip-flop or giving some extra connections.
To convert a RS flip-flop into D flip-flop, we simply have to remap the state transitions of D flip-flop’s K-map into equations of R and S inputs of flip-flop.

click to enlarge
The procedure for conversion of RS flip-flop to D flip-flop is as follows.
· Draw the K-map of R and S inputs separately with Input D and Present state Q.
· Fill the K-map using the data in the excitation table. When D=0 and Q=0, the next state Q (t+1) is 0. (Refer to D flip-flop truth table). For the next state to remain 0, the value of R and S should be X and 0 respectively. Here X denotes don’t care value. The value of R in this condition, will not affect the state of the system. 0->0 transition. R=X and S=0.
· When D=0 and Q=1, the value of Next state Q (t+1) should be 0. (Refer to D flip-flop truth table). Here there is a transition from 0 to 1. [Q=1 and Q (t+1) =0]. The RS input which corresponds to this transition is S=0 and R=1. 1-> 0 transition, R=1 and S=0.
· When D=1 and Q=0, the value of next state Q (t+1) should be 1(from D flip-flop truth table). Here there is 0 to 1 transition. The value of R and S should be 0 and 1 respectively. 0->1 transition, R=0 and S=1.
· When D=1 and Q=1, the value of next state should be equal to 1(from D flip-flop truth table). Here there is a 1->1 transition. The value of R and S corresponding to this transition is 0 and X respectively. X here represents don’t care condition. 1->1 transition, R=0 and S=X.
Thus from the above steps it is clear that the RS flip-flop can be converted to a D flip-flop.
K-Map and Logic diagram gives us a better understanding about the conversion of RS flip-flop to D flip-flop.
From the K-Map, we can conclude that S=D and R=D’.

click to enlarge

click to enlarge