The largest actively cycling terrestrial carbon pool, soil, has been disturbed during latest centuries by human actions through reduction of woody land cover. Soil organic carbon (SOC) content can reliably be estimated in laboratory conditions, but more cost-efficient and mobile techniques are needed for large-scale monitoring of SOC e.g. in remote areas. We demonstrate the capability of a mobile hyperspectral camera operating in the visible-near infrared wavelength range for practical estimation of soil organic carbon (SOC) and nitrogen content, to support efficient monitoring of soil properties. The 191 soil samples were collected in Taita Taveta County, Kenya representing an altitudinal gradient comprising five typical land use types: agroforestry, cropland, forest, shrubland and sisal estate. The soil samples were imaged using a Specim IQ hyperspectral camera under controlled laboratory conditions, and their carbon and nitrogen content was determined with a combustion analyzer. We use machine learning for estimating SOC and N content based on the spectral images, studying also automatic selection of informative wavelengths and quantification of prediction uncertainty. Five alternative methods were all found to perform well with a cross-validated R2 of approximately 0.8 and an RMSE of one percentage point, demonstrating feasibility of the proposed imaging setup and computational pipeline.