Low Filament Sensor for Creality CR-10?
TL;DR
You need to have the version 2.x controller board (and the associated CR-10S firmware) to use the filament sensor. If you do not then you will need to upgrade your controller board.

Board Comparison
For an excellent breakdown of the boards, read Creality CR-10 and CR-10S Models – What Printer do you have.
There appear to be two basic model versions of controller board, which use different firmware:

Controller board v1.1.2 (or v1.1.3 with additional filter capacitor) which uses CR-10 firmware. These have a small Atmel ATmega1284P chip, and one Z-axis stepper connector;
Controller board v2.0 (or v2.1 with extra fan ports) which uses CR-10S firmware. These have a large Atmel ATmega2560 chip, and two Z-axis stepper connectors.

See the section Board examples at the bottom of this answer for a visual comparison of the two boards.
It is the v2.x (CR-10S) board that has the filament detector, which uses the X+ endstop connector:

To quote part of the page:

Please make sure you know what printer you have. There are 8 DIFFERENT models from Creality. There are 2 different boards across these models. The easiest way to identify what one you have is if it has a filament sensor or not. If it does then you have a CR-10S machine. If it does not then it is a CR-10.
Just because you have a CR-10 S4 or CR-10 S5 that does NOT make it a CR-10S.
The S4 and S5 sizes come available with either board versions. Again the main way to tell is if you have a filament sensor from Creality or not. Whether you have Dual Z or not does NOT matter. What matters is what board is in the enclosure.
Typically every CR-10S board came with a filament sensor. So if you don’t have a filament sensor then it is the CR-10 and you need use the CR-10 firmware. However we have seen some CR-10 Mini machines ship with CR-10S boards. Use the below pictures of the boards that are in the wild to identify what model you have. The important thing is to use the correct firmware for the board that is in your machine.


Separate upgrade
With respect to the first question, you would be best off contacting Creality directly, via their customer support, to see if the sensor is available separately. This would probably make for the least painful method of implementing the filament sensor.
Alternatively, there is this kit, Creality CR-10S Upgrade Kit, for $120:

Best Upgrade Kit for your Creality CR-10 3D Printer contains Dual Z axis for Stability in 3D Prints &amp; Filament Monitoring Alarm Protection (Sensor) which alerts you when the filament has ran out or broken for Smart 3D Printing


There seems to be a dual-Z option, for an extra $80

Hacked solution
For the second question, the XCSOURCE 1.75mm 3D Printer Filament Detection Sensor Module Filament Run Out Pause Monitor for 3D Printer DIY Kit TE720,

the instructions state that it is designed principally for Lerdge control boards:

Instruction:

When you are using a Lerdge brand motherboard: The green light on the motherboard will turn off when the filament runs out, the
motherboard will stop printing until you supplement the filament and
continue printing. (Please connect to the M-sensor Interface)
When you are using other brand motherboard: The Detection Module uses the level transition detection method. While there still have
filament in the module, the detection port shows as high level; when
there is no filament in the module, the detection port will transform
to low level as &quot;Filament Run Out Command&quot; which will stop the
printing, so you will have time to supplement the filament and
continue printing.


So, it is not particularly clear as to whether it will work with your board - for it to do so, your board would need to have:

A compatible input (i.e. X+ endstop);
The compatible firmware (CR-10S), and;
Use compatible logic levels (i.e. active LOW to shutdown printing).

If not, then given point #2, it would appear to require additional external logic, or microcontroller, to sense the transition to LOW and then shutdown the printer.
For example, this chap on Thingiverse, Cr-10 Filament Sensor Bracket &amp; Tutorial, states that they bought a sensor off eBay, that looks similar, and they provide a printable mount and instructions on how to use it with a CR-10. However, it is not a standalone affair as shown in the CR-10 S4 - because an additional Raspberry Pi and OctoPrint is required.
To use this particular sensor with your board, you would need to:

See if which controller board you have - either the CR-10 or the CR-10S compatible board (see Board Comparison above). If it is the CR-10S therefore it has the compatible input (X+ endstop), and firmware, needed for the filament sensor,

Enable the use of the sensor, if necessary, in the firmware (either by the UI if possible or uploading new firmware) and;

Check whether the CR-10 controller board uses active LOW to detect a lack of filament (or again, this may be a UI, or firmware, setting)
You could test this last point yourself, by applying a LOW level voltage (i.e. grounding) to X+ endstop input on the control board (after checking the UI/firmware for appropriate settings), and see if that halts/pauses the print. If not, try a HIGH level (5 V). If it is active HIGH then you simply need to use an inverter (i.e. 4069), between the sensor and the X+ endstop connector.



Board examples
There are two principle board options, v1.x and v2.x, the latter has dual Z stepper motor connectors and the former does not .For example:
Version 1.x, for CR-10 firmware - Motherboard Controller DIY Creality 3D® CR-10 / CR-10S 3D Printer CR-10 Upgrade Control Board12V (CR-10S Mainboard)

Version 2.x (2.1 in this case) with Dual Z stepper connectors, for CR-10S firmware -  Luxnwatts CR-10S Mainboard Replacement Controller Board Upgrade V2.1 Motherboard For Creality S4 S5 3D Printer