I don't know about the first one. It looks like a plug/socket arrangement.
I think the second cable is soldered directly into the board. The plastic bits are only there to stop the wires from being bent sharply where they join the board and eventually breaking. If that's the case, you will need to desolder the wires individually.