Brightness control with PWM dimming LED driver LM3406/06HV
The DIM pin is used for PWM dimming from a control signal:


  Connect a logic-level PWM signal to this pin to enable/disable the power MOSFET and reduce the average light output of the LED array. Logic high = output on, logic low - output off.


So if you connect a 50% PWM signal to the dim pin, the led connected to the driver is dimmed to 50%.

The VINS pin is used to detect PMW dimming on the Voltage input:


  Adding an external input diode and using the internal VINS comparator allows the LM3406 family to sense and respond to dimming that is done by PWM of the input voltage. This method is also referred to as "Two-Wire Dimming", and a typical application circuit is shown in . If the VINS pin voltage falls 70% below the VIN pin voltage, the LM3406 family disables the internal power FET and shuts off the current to the LED array. The support circuitry (driver, bandgap, VCC) remains active in order to minimize the time needed to the turn the LED back on when the VINS pin voltage rises and exceeds 70% of VIN. This minimizes the response time needed to turn the LED array back on.


It uses a diode and a capacitor to smooth the input, and allow it to dim that way. See 8.11 for details.

If you want to take a steady but variable voltage input, and dim the led by the range of the input, you would need a circuit to measure the voltage, and produce a PWM signal to the DIM pin. Any common microcontroller should do.