As Wikipedia explains it:
The main purpose of an inlet cone is to slow the flow of air from supersonic flight speed to a subsonic speed before it enters the engine. Except for scramjet engines, all airbreathing jet engines need subsonic airflow to operate properly, and require a diffuser to prevent supersonic airflow inside the engine. At supersonic flight speeds a conical shock wave, sloping rearwards, forms at the apex of the cone. Air passing through the conical shock wave (and subsequent reflections) slows to a low supersonic speed. The air then passes through a strong normal shock wave, within the diffuser passage, and exits at a subsonic velocity. The resulting intake system is more efficient (in terms of pressure recovery) than the much simpler pitot intake.
If the flow was supersonic inside the engine, it would not be able to maintain fuel burn.
The pointyness of supersonic jets' inlet cone is dictated by the distance from the tip of the cone to the engine inlet and the inlet diameter. Also, the shockwave must be kept at right location in relation to the engine inlet, so the location of the cone is adjustable (by computer)
The inlet cone is shaped so that the shock wave that forms on its apex is directed to the lip of the intake; this allows the intake to operate properly in supersonic flight. As speed increases, the shock wave becomes increasingly more oblique (the cone gets narrower). For higher flight speeds inlet cones are designed to move axially to control how the capture area varies with the duct internal throat area. For best intake operation this required area ratio gets bigger with increasing flight Mach number, hence the large inlet cone movement on the SR-71 which had to perform well from low speeds to Mach 3.2.
The engine in the first picture is not of a supersonic aircraft. It is a high bypass turbofan, and the cone in that engine has no other function but to serve as an aerodynamic form covering the end of the axel. The other picture (actually quite obviousy taken form the Wikipedia article I referenced above...) is a supersonic engine inlet cone of MiG-21MF
For the most interesting reading about supersonic engines, please see this Wikipedia article about the J58, an engineering marvel from more than sixty years ago. It still stands as one of, if not the most inspirational jet engine.
The article has a nice schliering photograph of what happens when the shocwave is not in the place it should be (NASA document ID: C-1955-37520, public domain):