The feedback goes into the D input, the output of a two input OR gate. One OR input is J, the set input. If it is high Q goes high on the next clock edge irrespective of K the reset input or the current state of Q. The other OR input is the output of a two input AND gate with ine inverted input. The inverted input is K and the noninverted input is the Q output. If both J and K are low Q is fed back into D and the FF retains it's state. If K is high and J is low the D input is low and the FF is reset, so J is dominant over K. Now interchange the OR and AND
gates and think about the behaviour, the reset is dominant over the set input. You can expand the number of gates and inputs to get various things like clocked D FFs, multi-input JKs, gated T FFs etc. It's all based on D FFs and feedback.